# gmssl paths
LIBDIR = /opt/gmssl/lib
INCDIR = /opt/gmssl/include

# Compiler and flags
CC      = gcc
CFLAGS  = -Wall -I$(INCDIR)
LDFLAGS = -L$(LIBDIR) -Wl,-rpath,$(LIBDIR)
LIBS    = $(LIBDIR)/libcrypto.a -lpthread -ldl

# Target and source files
TARGET = pek_oca
SRCS   = pek_oca.c csvcert.c
OBJS   = $(SRCS:.c=.o)

.PHONY: all clean

all: $(TARGET)

$(TARGET): $(OBJS)
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)

%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

clean:
	rm -f $(OBJS) $(TARGET)

